package com.newsproject.controller;


import com.newsproject.service.MinioService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
@Controller
@Api(tags = "文件上传")
@RequestMapping("/file")
public class FileController {


    @Resource
    private MinioService minioService;


    @PostMapping("/uploadPicture")
    @ResponseBody
    @ApiOperation(value = "上传图片", notes = "form-data格式上传图片")
    public String uploadPicture(@RequestParam MultipartFile file) throws Exception {
        return minioService.uploadImage(file);
    }

    @PostMapping("/uploadVideo")
    @ResponseBody
    @ApiOperation(value = "上传视频", notes = "form-data格式上传视频")
    public String uploadVideo(@RequestParam MultipartFile file) throws Exception {
        return minioService.uploadVideo(file);
    }




}
